package test01;

import java.math.BigDecimal;

/**
 * @ Author:     15744
 * @ Date:       2024/1/29 14:32
 * @ Created by  15744
 * @ Description:
 * @author 15744
 */
public class Factorial {
    
    public static void main(String[] args) {
        BigDecimal bigDecimal = new BigDecimal("50");
        
        System.out.println(bigFactorial(bigDecimal));
        
//        System.out.println(intFactorial(50));
        
    }
    
    
    
    public static BigDecimal bigFactorial(BigDecimal num){
        BigDecimal bigOne = new BigDecimal("1");
        if (num.equals(bigOne)){
            return bigOne;
        }else {
            return num.multiply(bigFactorial(num.subtract(bigOne)));
        }
    }
    
    public static int intFactorial(int num){
        if (num == 1){
            return 1;
        }else {
            return num * intFactorial(num - 1);
        }
    }
    
}
